package basics.designpattern.singleton;


/**
 * @author or2
 * @Description 针对线程 - 单例 (空间 换 时间, 如 copyOnRight*)
 * @create 2021年09月01日 时间: 16:37
 */
public class ThreadLocalInstance {
    private static final ThreadLocal<ThreadLocalInstance> threadLocalInstanceThreadLocal = new ThreadLocal<>(){
        @Override
        protected ThreadLocalInstance initialValue() {
            return new ThreadLocalInstance();
        }
    };

    private ThreadLocalInstance(){}

    public static ThreadLocal<ThreadLocalInstance> getInstance(){
        return threadLocalInstanceThreadLocal;
    }

}
